package com.shrct.businessprocess.product.impl;

import com.shrct.businessprocess.product.RCLogicProduct;
import com.shrct.businessprocess.product.RCLogicProductEvent;
import com.shrct.businessprocess.product.impl.RCLogicProductImpl;
import com.shrct.businessprocess.product.impl.RCProductEventImpl;
import com.shrct.businessprocess.product.proxy.RCLogicProductEventProxy;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Entity
@DiscriminatorValue("RCLOGICPRODUCTEVENT_TYPE")
public abstract class RCLogicProductEventImpl extends RCProductEventImpl implements RCLogicProductEvent {
  public RCLogicProductEventImpl() {
    super();
  }
  
  public RCLogicProductEventImpl(final RCLogicProduct logicProduct) {
    super();
    this.logicProduct = logicProduct;
  }
  
  @JoinColumn(name = "logicProduct_id")
  @ManyToOne(targetEntity = RCLogicProductImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCLogicProduct logicProduct;
  
  public RCLogicProduct getLogicProduct() {
    return this.logicProduct;
  }
  
  public RCLogicProductEvent setLogicProduct(final RCLogicProduct logicProduct) {
    this.logicProduct = logicProduct;
    return this;			
    
  }
  
  public RCLogicProductEventProxy toProxy() {
    com.shrct.businessprocess.product.proxy.RCLogicProductEventProxy proxy = new com.shrct.businessprocess.product.proxy.RCLogicProductEventProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
